# 该脚本会在每个 *_img_human 文件夹下先检测 names.txt，
# 如果不存在，则会调用 restore.sh 进行处理

check_and_restore() {
    DIR="$1"
    if [ ! -f "${DIR}/names.txt" ]; then
        echo "names.txt 不存在，正在还原: $DIR"
        bash restore.sh "$DIR"
    else
        echo "names.txt 存在: $DIR"
    fi
}

process_cp() {
    SRC="$1"
    DST="$2"
    NUM="$3"

    check_and_restore "$SRC"
    python cp_num.py -s "$SRC" -t "$DST" -n "$NUM"
}

process_cp /mnt/nas/datasets/diction/dress0917_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/dress0917_500 500
process_cp /mnt/nas/datasets/diction/dress0918_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/dress0918_500 500
process_cp /mnt/nas/datasets/diction/dress0919_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/dress0919_500 500

# coat 0901 0902 0903 num 200
process_cp /mnt/nas/datasets/diction/coat0901_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/coat0901_200 200
process_cp /mnt/nas/datasets/diction/coat0902_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/coat0902_200 200
process_cp /mnt/nas/datasets/diction/coat0903_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/coat0903_200 200

# leather 0819 0820 0821 num 200
process_cp /mnt/nas/datasets/diction/leather0819_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/leather0819_200 200
process_cp /mnt/nas/datasets/diction/leather0820_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/leather0820_200 200
process_cp /mnt/nas/datasets/diction/leather0821_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/leather0821_200 200

# sweater 0901 0902 0903 num 200
process_cp /mnt/nas/datasets/diction/sweater0901_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/sweater0901_200 200
process_cp /mnt/nas/datasets/diction/sweater0902_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/sweater0902_200 200
process_cp /mnt/nas/datasets/diction/sweater0903_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/sweater0903_200 200

# paike 0916 num 200
process_cp /mnt/nas/datasets/diction/paike0916_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/paike0916_200 200

# trench 0916 0917 num 200
process_cp /mnt/nas/datasets/diction/trench0916_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/trench0916_200 200
process_cp /mnt/nas/datasets/diction/trench0917_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/trench0917_200 200

# leafur 0916 num 200
process_cp /mnt/nas/datasets/diction/leafur0916_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/leafur0916_200 200

# slipdress 0917 0918 0919 num 200
process_cp /mnt/nas/datasets/diction/slipdress0917_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/slipdress0917_200 200
process_cp /mnt/nas/datasets/diction/slipdress0918_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/slipdress0918_200 200
process_cp /mnt/nas/datasets/diction/slipdress0919_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/slipdress0919_200 200

# suit 1022 1023 1024 num 200
process_cp /mnt/nas/datasets/diction/suit1022_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/suit1022_200 200
process_cp /mnt/nas/datasets/diction/suit1023_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/suit1023_200 200
process_cp /mnt/nas/datasets/diction/suit1024_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/suit1024_200 200

# jacket 1028 1029 1030 num 200
process_cp /mnt/nas/datasets/diction/jacket1028_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/jacket1028_200 200
process_cp /mnt/nas/datasets/diction/jacket1029_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/jacket1029_200 200
process_cp /mnt/nas/datasets/diction/jacket1030_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/jacket1030_200 200

# hoodie 1029 1030 num 200
process_cp /mnt/nas/datasets/diction/hoodie1029_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/hoodie1029_200 200
process_cp /mnt/nas/datasets/diction/hoodie1030_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/hoodie1030_200 200

# jean 0819 0820 0821 num 200
process_cp /mnt/nas/datasets/diction/jean0819_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/jean0819_200 200
process_cp /mnt/nas/datasets/diction/jean0820_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/jean0820_200 200
process_cp /mnt/nas/datasets/diction/jean0821_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/jean0821_200 200

# trousers 1022 1023 1024 num 200
process_cp /mnt/nas/datasets/diction/trousers1022_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/trousers1022_200 200
process_cp /mnt/nas/datasets/diction/trousers1023_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/trousers1023_200 200
process_cp /mnt/nas/datasets/diction/trousers1024_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/trousers1024_200 200

# widepants 1029 1030 num 200
process_cp /mnt/nas/datasets/diction/widepants1029_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/widepants1029_200 200
process_cp /mnt/nas/datasets/diction/widepants1030_img_human/ /mnt/nas/shengjie/datasets/KontextRefControl_TryON/widepants1030_200 200
